package com.sparrow.source.common.dto.convert;

import com.sparrow.source.common.dto.FeiYouResponse;
import com.sparrow.source.common.dto.Result;
import com.sparrow.source.common.enums.ResultEnum;
import org.springframework.stereotype.Component;

/**
 * 飞友用户数据转化到数据库
 *
 * @author bryceyung
 * @since 2024/11/16
 */
@Component
public class FeiYouConvert {

    public Result convertFeiYouResponse(FeiYouResponse response) {
        Result result = Result.build(response.getCode() == 0 ? ResultEnum.SUCCESS : ResultEnum.FAILED_DEPENDENCY);
        result.setMessage(response.getMsg());
        result.setObject(response.getData());
        return result;
    }

}
